<?php

$this->breadcrumbs = array(
        $block->code . ' lakásai',
);

    /* @var $this FlatController */
    /* @var $model Flat */
    /* @var $form BootActiveForm */
    /* @var $block Block */


        $this->beginWidget('system.web.widgets.CClipWidget', array('id'=>'block-selector'));

            $form=$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
                    'action'=> $this->createUrl('flat/index'),
                    'id'=>'block-select-form',
                    'enableAjaxValidation'=>false,
                    'type'=>'horizontal',
                    'htmlOptions'=>array('style'=>'height: 10px; padding-top:0px;'),
                    'method'=>'get',
            ));

            ?>

            <i class="icon-building"></i>
                <?php

                if(count($blocks) > 1){
                    echo CHtml::dropDownList('blockId', $block->id, $blocks, array(
                        'onchange'=>'this.form.submit();',
                        'style'=>'position:relative; top: -5px;'
                    ));
                }else if(count($blocks) == 1){

                    echo '<span class="">'.array_pop($blocks).'</span>';

                }

            $this->endWidget();

        $this->endWidget();

        $this->beginWidget('application.components.widgets.Box', array('title'=>'!sitemap Lakások',
            'controls'=>$this->clips['block-selector']
        ));



    /* Column definition  */

    $columns = array(
            array(
                'name'=>'number',
                'htmlOptions'=>array('style'=>'width: 200px;'),
             ),
            array(
                 'name'=>'note',
                 'filter'=>'',
            )
    );

    $columns[] = array(
            'class'=>'bootstrap.widgets.BootButtonColumn',
            'template' => '{view} {update} {delete}',
            'buttons' => array(
                    'view' => array(
                            'label'=> 'Megtekint',
                            'options'=>array(
                                    'class'=>'btn view'
                            )
                    ),
                    'update' => array(
                            'label'=> 'Szerkeszt',
                            'options'=>array(
                                    'class'=>'btn btn-info update'
                            )
                    ),
                    'delete' => array(
                            'label'=> 'Töröl',
                            'options'=>array(
                                    'class'=>'btn btn-inverse delete'
                            )
                    )
            ),
            'htmlOptions'=>array('style'=>'width: 150px'),
    );

    $this->widget('bootstrap.widgets.BootGridView',array(
            'id'=>'flat-grid',
            'dataProvider'=>$model->search(),
            'summaryText'=>'',
            'emptyText'=>'Nincs lakás',
            'type'=>'striped condensed',
            'template'=>'{summary}{pager}{items}{pager}',
            'filter'=>$model,
            'columns'=>$columns
));
 ?>


<div class="form-actions">
    <?php
    echo CHtml::link('Új lakás', array('flat/create', 'blockId'=>$block->id), array('class'=>'btn btn-info'));
    ?>
</div>

<?php $this->endWidget(); ?>
